import cn.hutool.core.util.RandomUtil;
import com.bigmodel.entity.QAEntity;
import com.bigmodel.util.ExcelUtil;
import com.bigmodel.util.FtlUtil;
import org.junit.Test;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ChangShaSFT_20240413_V1 {

    private final static String OUT_PATH = "D:\\javacode\\bigmodel\\bigmodel\\ChangShaSFT_20240413_V1\\";

    private final static String FREEMARKER_BASE_PATH = "sft/ChangShaSFT_20240413_V1/";

    private static final int randomNumber = 20;



    private static final int MONTH12MAX = 12;
    private static final int DAY30MAX = 30;
    private static final int HOUR12MAX = 12;
    private static final int HOUR23MAX = 23;
    private static final int MINUTE59MAX = 59;
    private static String[] chinese_0_59 = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十", "二十一", "二十二", "二十三", "二十四", "二十五", "二十六", "二十七", "二十八", "二十九", "三十", "三十一", "三十二", "三十三", "三十四", "三十五", "三十六", "三十七", "三十八", "三十九", "四十", "四十一", "四十二", "四十三", "四十四", "四十五", "四十六", "四十七", "四十八", "四十九", "五十", "五十一", "五十二", "五十三", "五十四", "五十五", "五十六", "五十七", "五十八", "五十九"};
    private static String[] number_0_59 = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59"};

    private static String[] chinese_0_12 = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"};
    private static String[] number_0_12 = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"};

    private static String[] chinese_week = {"一", "二", "三", "四", "五", "六", "日"};
    private static String[] code_week = {"DayOfWeek.MONDAY", "DayOfWeek.TUESDAY", "DayOfWeek.WEDNESDAY", "DayOfWeek.THURSDAY", "DayOfWeek.FRIDAY", "DayOfWeek.SATURDAY", "DayOfWeek.SUNDAY"};



    private static String[] chinese_0_23 = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十", "二十一", "二十二", "二十三"};
    private static String[] number_0_23 = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"};

    private static String[] chinese_1_30 = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十", "二十一", "二十二", "二十三", "二十四", "二十五", "二十六", "二十七", "二十八", "二十九", "三十"};
    private static String[] number_1_30 = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30"};

    private static String[] questionTypeArr = {"统计", "查询", "搜索", "帮忙查一下", "帮我列一下", "统计出"};
    private static String[] weekStr0 = {"本周", "这周", "当周","这一周","这星期","这礼拜"};
    private static String[] weekStr1 = {"上周", "最近一周", "上个星期","上个礼拜","一周前"};
    private static String[] weekStr2 = {"上上周", "上上个星期", "上上个礼拜","两周前"};

    public static void main(String[] args) {

        T001();//今天***,今天九点过九分,今天9点过9分
        T002();//昨天***,昨天九点五分,昨天9点8分
        T003();//前天***,前天九点五分,前天9点8分
        T004();//明天***,明天九点五分,明天9点8分

    }


    private static void T001() {
        String code = "T001";
        String category = "";

        List<QAEntity> qaEntityList = new ArrayList<>();

        for(int i = 0 ; i <= 2;i++) { //时间 本 上 上上
            for(String questionType : questionTypeArr) {
                Map<String, Object> map = new HashMap<>();
                if(i == 0 ) {
                    for(String weekStr : weekStr0) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
                if(i == 1 ) {
                    for(String weekStr : weekStr1) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
                if(i == 2 ) {
                    for(String weekStr : weekStr2) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
            }
        }
        //输出到excel
        ExcelUtil.createExcel(qaEntityList, OUT_PATH + code + ".xls");
    }

    private static void T002() {
        String code = "T002";
        String category = "";

        List<QAEntity> qaEntityList = new ArrayList<>();

        for(int i = 0 ; i <= 2;i++) { //时间 本 上 上上
            for(String questionType : questionTypeArr) {
                Map<String, Object> map = new HashMap<>();
                if(i == 0 ) {
                    for(String weekStr : weekStr0) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
                if(i == 1 ) {
                    for(String weekStr : weekStr1) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
                if(i == 2 ) {
                    for(String weekStr : weekStr2) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
            }
        }
        //输出到excel
        ExcelUtil.createExcel(qaEntityList, OUT_PATH + code + ".xls");
    }
    private static void T003() {
        String code = "T003";
        String category = "";

        List<QAEntity> qaEntityList = new ArrayList<>();

        for(int i = 0 ; i <= 2;i++) { //时间 本 上 上上
            for(String questionType : questionTypeArr) {
                Map<String, Object> map = new HashMap<>();
                if(i == 0 ) {
                    for(String weekStr : weekStr0) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
                if(i == 1 ) {
                    for(String weekStr : weekStr1) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
                if(i == 2 ) {
                    for(String weekStr : weekStr2) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
            }
        }
        //输出到excel
        ExcelUtil.createExcel(qaEntityList, OUT_PATH + code + ".xls");
    }
    private static void T004() {
        String code = "T004";
        String category = "";

        List<QAEntity> qaEntityList = new ArrayList<>();

        for(int i = 0 ; i <= 2;i++) { //时间 本 上 上上
            for(String questionType : questionTypeArr) {
                Map<String, Object> map = new HashMap<>();
                if(i == 0 ) {
                    for(String weekStr : weekStr0) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
                if(i == 1 ) {
                    for(String weekStr : weekStr1) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
                if(i == 2 ) {
                    for(String weekStr : weekStr2) {
                        String userQuestion = questionType + weekStr + "告警图表信息";
                        int lastWeekNum = i + 1;
                        int thisWeekNum = i;
                        map.put("lastWeekNum", lastWeekNum);
                        map.put("thisWeekNum", thisWeekNum);
                        map.put("userQuestion", userQuestion);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + code + "/answer.ftl");
                        qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                    }
                }
            }
        }
        //输出到excel
        ExcelUtil.createExcel(qaEntityList, OUT_PATH + code + ".xls");
    }


}
